home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _PRINT.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  70 lines

  1. #define        CURSES_LIBRARY  1
  2. #define NEEDS_OS2       1
  3. #include <curses.h>
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid__print = "$Header: c:/curses/private/RCS/_print.c%v 2.0 1992/11/15 03:24:33 MH Rel $";
  7. #endif
  8.  
  9. #ifdef OS2
  10. #  if !defined (CURSES__32BIT__) && !defined(CSET2) && !defined(MSC)
  11. #define INCL_DOS
  12. #include <bsedos.h>
  13. #endif
  14. char Printer[]="LPT1:";
  15. #endif
  16.  
  17.  
  18. /*man-start*********************************************************************
  19.  
  20.   PDC_print()  - Provides primitive access to the BIOS printer functions
  21.  
  22.   PDCurses Description:
  23.        This is a private PDCurses routine.
  24.  
  25.        Implements write/init/read printer services at the BIOS level.
  26.  
  27.        This provides the basic support that PDCurses needs to dump the
  28.        contents of windows or pads to the printer attached to the BIOS
  29.        printer port.
  30.  
  31.   PDCurses Return Value:
  32.        See the BIOS INT 0x17 specifications.
  33.  
  34.   PDCurses Errors:
  35.        See the BIOS INT 0x17 specifications.
  36.  
  37.   Portability:
  38.        PDCurses        int PDC_print( int cmd, int byte, int port );
  39.  
  40. **man-end**********************************************************************/
  41.  
  42. int    PDC_print(int cmd, int byte, int port)
  43. {
  44. #ifdef FLEXOS
  45.        return( OK );
  46. #endif
  47. #ifdef DOS
  48.        int     status = 0;
  49.  
  50.        regs.h.ah = (unsigned char)cmd;
  51.        regs.h.al = (unsigned char)byte;
  52.        regs.x.dx = (unsigned int)port;
  53.        int86(0x17, ®s, ®s);
  54.        status = regs.h.ah;
  55.        return (status);
  56. #endif
  57. #ifdef OS2
  58. #  if !defined (CURSES__32BIT__) && !defined(CSET2)
  59.        HFILE Lpt;
  60.        USHORT Action;
  61.        USHORT NoWritten;
  62.        if (DosOpen((PSZ)Printer, &Lpt, &Action, 0,0,0,0,0) != 0)
  63.                return(ERR);
  64.        DosWrite(Lpt,&byte,1,&NoWritten);
  65.        DosClose(Lpt);
  66.        return(NoWritten == 1);
  67. #  endif       
  68. #endif
  69. }
  70.